﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Security.Cryptography.X509Certificates;

namespace Tokens
{
   class CertWebClient : WebClient
   {
      X509Certificate2 _certificate;
      public CertWebClient(X509Certificate2 certificate)
      {
         _certificate = certificate;
      }

      protected override WebRequest GetWebRequest(Uri address)
      {
         HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
         request.ClientCertificates.Add(_certificate);
         return request;
      }
   }
}
